#!/usr/bin/env bash
# Copyright (c) 2024 maminjie <canpool@163.com>
# SPDX-License-Identifier: MulanPSL-2.0

method_def iso

OECUSTOM_DIR=$SHCANPOOL_DIR/tools/oecustom

usage_iso() {
    module_usage "iso" "Custom iso image tool"
}

do_iso() {
    module_do "iso" "$@"
}

iso_usage_help() {
    module_usage_help iso
}

# iso_do_help subcmd
iso_do_help() {
    module_do_help iso "$1"
}

# __iso_get_subcmd cmd
#   Get the fullname of cmd
# Returns:
#   "" or fullname
__iso_get_subcmd() {
    local cmd=""
    case "${1}" in
        "h"|"help")
            cmd="help"
            ;;
        "mk"|"make")
            cmd="make"
            ;;
        "cs"|"custom")
            cmd="custom"
            ;;
        "ct"|"cut")
            cmd="cut"
            ;;
        *)
            ;;
    esac
    echo "$cmd"
}

iso_usage_make() {
printf "make (mk): make iso image based on yum repository

usage:
    ${PROG} iso mk [options] <args...>
\n"
}

iso_do_make() {
    script_do_bash "$OECUSTOM_DIR/iso_make.sh" "$@"
}


iso_usage_custom() {
printf "custom (cs): customize operating system from openeuler iso

usage:
    ${PROG} iso cs [options] <args...>
\n"
}

iso_do_custom() {
    script_do_bash "$OECUSTOM_DIR/iso_custom.sh" "$@"
}


iso_usage_cut() {
printf "cut (ct): cut operating system iso image

usage:
    ${PROG} iso cut [options] <args...>
\n"
}

iso_do_cut() {
    script_do_bash "$OECUSTOM_DIR/iso_cut.sh" "$@"
}

